<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no" />
	<title>速翔网络</title>
	<link rel="stylesheet" type="text/css" href="../c/aui.css" />
	<link rel="stylesheet" type="text/css" href="../c/animate.css" />
	<style>
		body {
			background: #f3f3f3;
			color: #222;
		}
		.li{
			padding: 0.75rem;
			margin-bottom: 0.75rem;
		}
		.li,.li .l{
			display: flex;
			justify-content:flex-start;
			align-items: center;
			background: #fff;
		}
		.li .l-l{
			width: 3.8rem;
			height: 3.8rem;
			margin-right: 0.5rem;
		}
		.li .l-r{
			width: 100%;
		}
		.li .l{
			width: 100%;
			margin-right: 0.75rem;
		}
		.l-r div{
			color: #888;
			font-size: 0.65rem;
			padding: 0.1rem 0;
		}
		.l-r div.title{
			font-size: 0.85rem;
			color: #222;
			margin-bottom: 0.3rem;
		}
		.li .r{
			/*background: #f00;*/
			width: 2rem;
			height: 100%;
			height: 3.5rem;
			display: flex;
			align-items: center;
		}
		.li .r img{
			width: 0.9rem;
			text-align: center;
			margin: 0 auto;
		}
		#tiao{
			background: #FE2C55;
			border-radius: 0.15rem;
			padding: 0.1rem 0.35rem;;
			display: inline-block;
			color: #fff;
			font-size: 0.55rem;
		}
		#loadingNo{
			color: #222;
		}
	</style>
</head>

<body>
	<div class="aui-content">
		<script id="sx-list" type="text/x-dot-template">
			{{ for(var i=0,it=it.data; i < it.length; i++) { }}
			<div class="li" id="id{{= it[i].id }}">
				{{? it[i].hide ==1}}
				<div class="l" tapmode onclick="_url({id:{{= it[i].id}}},'shop_view_win')">
				{{??}}
				<div class="l" tapmode onclick=" return _msg('{{= it[i].hide_name}}') ">
				{{?}}
					<img class="l-l" src="../i/loading_a.png" suxiangw-src="{{= _img(it[i].img,api.winWidth/2.5) }}">
					<div class="l-r">
						<div class="title aui-ellipsis">{{= it[i].title}}</div>
						<div class="money">价格：{{= it[i].money}}元</div>
						{{? it[i].url}}
						<div class="kucun" id="tiao">来自第三方</div>
						{{??}}
						<div class="kucun">库存：{{= it[i].num}}</div>
						{{?}}
						<div class="hide">状态：{{= it[i].hide_name}}</div>
					</div>
				</div>
				{{? it[i].hide ==0}}
				<div class="r" tapmode onclick=" return _msg('禁止商品无法操作') ">
					<img src="../i/shop/dian.png">
				</div>
				{{??}}
				<div class="r" tapmode onclick="shop({{= it[i].id }},{{= it[i].url ? true : false }})">
					<img src="../i/shop/dian.png">
				</div>
				{{?}}
			</div>
			{{ } }}
		</script>
		<div class="ul" id="sx-view"><div id="jiazai" style="padding-top:50%"><img src="../i/loading_more.gif" /></div></div>
	</div>
</body>
<script type="text/javascript" src="../j/api.js"></script>
<script type="text/javascript">
	var hide = 0
	apiready = function() {
		hide = api.pageParam['hide'];
		if(hide){
			url = 'shop/user_list?hide='+hide;
		}else{
			url = 'shop/user_list';
		}
		_shangla(function(ret,err){
			console.log(url)
			_list({url:url,loading:1});
		})
		// 监听滚动
		api.addEventListener({
			name : 'scrolltobottom',
		}, function(ret, err) {
			if (heigutgao == 1) {// heigutgao=1开启执行 0停止执行   防止连续滚动，等加载数据之后在进行滚动。
				pagenum += 1
				_list({url:url,page:pagenum});
			}
		});
	}

	function a(_this){
		$('.a').removeClass('a');
		$(_this).addClass('a');
	}
	function shop(id,post_url){
    api.actionSheet({
        title: '请选择操作方式',
        cancelTitle: '取消',
        buttons: ['编辑商品', '删除商品']
    }, function(ret, err) {
			if(ret.buttonIndex == 1){
				_url_shop({url:'shop_add',id:id,title:'编辑商品',post_url:post_url})
			}else if(ret.buttonIndex == 2){
				_suxiangw_msg({content:'确认要删除吗？',rightTitle:'确认删除',url:'del('+id+')'})
			}
		});
	}
	function del(id){
		$('#id'+id).addClass('animated bounceOutLeft');
		setTimeout(function(){
			$('#id'+id).hide();
		},500)
		_ajax('shop/del',function(ret,err){
			console.log(JSON.stringify(ret)+JSON.stringify(err));
		},{vid:id})
	}
</script>

</html>
